package com.kongjs.application.service.impl;

import cn.hutool.core.util.IdUtil;
import com.kongjs.application.mapper.AreasMapper;
import com.kongjs.application.mapper.ExpressesFlowMapper;
import com.kongjs.application.mapper.ExpressesMapper;
import com.kongjs.application.model.dto.*;
import com.kongjs.application.model.entity.Expresses;
import com.kongjs.application.service.CodeService;
import com.kongjs.application.service.OrderService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {
    @Resource
    private AreasMapper areasMapper;
    @Resource
    private ExpressesMapper expressesMapper;
    @Resource
    private ExpressesFlowMapper expressesFlowMapper;
    @Resource
    private CodeService codeService;

    /*
     * 订单id
     * */
    @Override
    public String getOrderId() {
        return "EXP" + IdUtil.getSnowflakeNextIdStr();
    }

    @Override
    public boolean create(CreateOrderDTO createOrderDTO) {
        Expresses expresses = new Expresses();
        int insert = expressesMapper.insert(expresses);
        return true;
    }

    @Override
    public PageDTO<OrderDTO> getOrderPageByUser(PageQueryDTO pageQueryDTO, Long userId, String status) {
        return null;
    }

    @Override
    public OrderDetailDTO getOrderDetailById(Long orderId) {
        return null;
    }

    @Override
    public QrCodeDTO generateQrCode() {
        String qcode = codeService.qcode();
        QrCodeDTO dto = new QrCodeDTO();
        dto.setQrCodeImage(qcode);
        return dto;
    }
}
